package extensions;

import com.imagotag.test.Test;
import com.imagotag.test.TestCase;
import com.imagotag.test.TestCaseResult;
import lombok.Getter;
import lombok.Setter;

import java.util.Map;

/**
 * @projectName: esl-test-frame
 * @className: TestCaseWithEV
 * @description: 测试用例类，扩写原测试用例，使其包含期望值
 * @author: JLONG
 * @date: 2024/8/12 13:53
 * @version: 1.0
 */
@Getter
@Setter
public class TestCaseWithEV <R extends TestCaseResult> implements TestCase<R>  {

    private Map<?, ?> expectedValue;
    private TestCase <R> testCase;
    private R testResult;

    public TestCaseWithEV (TestCase<R> testCase, Map<?, ?> expectedValue) {
        this.testCase = testCase;
        this.expectedValue = expectedValue;
    }

    @Override
    public R run(Test test) throws Exception {

        this.testResult = testCase.run(test);
        return testResult;
    }
}
